CC=arm-apple-darwin-gcc
CXX=arm-apple-darwin-g++

LD=$(CC)
LDFLAGS = -framework CoreFoundation \
          -framework Foundation \
          -framework CFNetwork \
          -framework UIKit \
          -framework LayerKit \
          -framework CoreGraphics \
          -framework GraphicsServices \
          -framework CoreSurface \
	  -framework WebCore \
	  -lcrypto \
	  -lsqlite3 \
          -lobjc

TARGET=iSpotter
OBJECTS=main.o SiteTable.o SiteBrowser.o LogTable.o LogBrowser.o LogDB.o SimpleWebView.o MainView.o Location.o APLocation.o LockyDB.o SpotterApp.o SimpleHTTPConnection.o SimpleHTTPServer.o MSNetworksManager.o WifiDB.o

TARGET2=locky2dbm
OBJECTS2=locky2dbm.o

all:	$(TARGET) $(TARGET2)

install: $(TARGET) $(TARGET2)
	mkdir -p iSpotter.app
	cp iSpotter iSpotter.app
	cp maps.html iSpotter.app
	cp detect.html iSpotter.app
	cp message.html iSpotter.app
	cp maps.js iSpotter.app
	cp images/icon.png iSpotter.app
	cp images/line.png iSpotter.app
	cp images/line1.png iSpotter.app
	cp images/line-no.png iSpotter.app
	cp images/trail1.png iSpotter.app
	cp images/trail2.png iSpotter.app
	cp images/trail3.png iSpotter.app
	cp images/allow.png iSpotter.app
	cp images/deny.png iSpotter.app
	cp images/Default.png iSpotter.app
	cp images/centerCross*.gif iSpotter.app
	cp images/zoom*.png iSpotter.app
	cp images/curPos*.png iSpotter.app
	cp images/changeView*.png iSpotter.app
	cp images/detect*.png iSpotter.app
	cp locky2dbm iSpotter.app
	cp Info.plist iSpotter.app

$(TARGET):	$(OBJECTS)
	$(LD) $(LDFLAGS) -o $@ $^

$(TARGET2):	$(OBJECTS2)
	$(LD) $(LDFLAGS) -o $@ $^

%.o:	%.m %.h version.h
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

main.o: main.m
	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@

clean:
	rm -f *.o $(TARGET) $(TARGET2)
